package cn.wubo.chatbot.demo;

import cn.wubo.chatbot.core.ChatbotService;
import cn.wubo.chatbot.message.RequestContent;
import cn.wubo.chatbot.message.SubLine;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class DemoController {

    @Autowired
    ChatbotService chatbotService;

    @GetMapping(value = "/chat/robot/test")
    public String send() {
        //发送到全部平台
        /*return chatbotService.send(
                RequestContent.buildMarkdown()
                        .title("测试群发")
                        .addLine(SubLine.title("这是标题1",1))
                        .addLine(SubLine.title("这是标题2",2))
                        .addLine(SubLine.text("这是一个文本"))
                        .addLine(SubLine.link("这是一个链接","https://gitee.com/wb04307201/chatbot-spring-boot-starter"))
                        .addLine(SubLine.quote("这是一个引用"))
                        .addLine(SubLine.bold("这是一个加粗"))
                        .atAll(true)
        ).toString();*/

        //发送到某类平台
        /*return chatbotService.send(
                RequestContent.buildMarkdown()
                        .addChatbotType(ChatbotType.DINGTALK)
                        .title("测试群发")
                        .addLine(SubLine.title("这是标题1",1))
                        .addLine(SubLine.title("这是标题2",2))
                        .addLine(SubLine.text("这是一个文本"))
                        .addLine(SubLine.link("这是一个链接","https://gitee.com/wb04307201/chatbot-spring-boot-starter"))
                        .addLine(SubLine.quote("这是一个引用"))
                        .addLine(SubLine.bold("这是一个加粗"))
                        .atAll(true)
        ).toString();*/

        //发送到某几个平台
        return chatbotService.send(
                RequestContent.buildMarkdown().addAlias("dd-1", "mail-1")
                        .title("测试群发")
                        .addLine(SubLine.title("这是标题1", 1))
                        .addLine(SubLine.title("这是标题2", 2))
                        .addLine(SubLine.text("这是一个文本"))
                        .addLine(SubLine.link("这是一个链接", "https://gitee.com/wb04307201/chatbot-spring-boot-starter"))
                        .addLine(SubLine.quote("这是一个引用"))
                        .addLine(SubLine.bold("这是一个加粗"))
                        .atAll(true)
        ).toString();
    }
}
